home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
076-100
/
084
/
ed
/
doprnt.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-13
|
1KB
|
81 lines
/*
* Copyright 1987 Brian Beattie Rights Reserved.
*
* Permission to copy and/or distribute granted under the
* following conditions:
*
* 1). No charge may be made other than resonable charges
* for reproduction.
*
* 2). This notice must remain intact.
*
* 3). No further restrictions may be added.
*
*/
#include <stdio.h>
#include "tools.h"
#include "ed.h"
doprnt(from, to)
int from, to;
{
int i;
from = from < 1 ? 1 : from;
to = to > lastln ? lastln : to;
if(to != 0)
{
for(i = from; i <= to; i++)
prntln(gettxt(i), lflg, (nflg ? i : 0));
curln = to;
}
return(0);
}
prntln(str, vflg, lin)
char *str;
int vflg, lin;
{
if(lin)
fprintf(stdout,"%7d ",lin);
while(*str && *str != NL)
{
if(*str < ' ' || *str >= 0x7f)
{
switch(*str)
{
case '\t':
if(vflg)
putcntl(*str, stdout);
else
putc(*str, stdout);
break;
case DEL:
putc('^', stdout);
putc('?', stdout);
break;
default:
putcntl(*str, stdout);
break;
}
} else
putc(*str, stdout);
str++;
}
if(vflg)
putc('$',stdout);
putc('\n', stdout);
}
putcntl(c, stream)
char c;
FILE *stream;
{
putc('^', stream);
putc((c&31)|'@', stream);
}